package com.msy.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

/**
 * @date 2020/11/21 - 17:32
 */
@Service
public class mail {
    @Autowired
    JavaMailSenderImpl mailSender;

    @Scheduled(cron = "0/2 * * * * ?")
    void contextLoads() {
        SimpleMailMessage simpleMailMessage = new SimpleMailMessage();
        simpleMailMessage.setSubject("你好呀，马思艺");
        simpleMailMessage.setText("祝你天天开心哦！");
        simpleMailMessage.setTo("masiyi163163@163.com");
        simpleMailMessage.setFrom("1663593534@qq.com");

        mailSender.send(simpleMailMessage);

    }


}
